# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Simon Hauser <Simon-Hauser@outlook.de>
# Contributor: Wesley Moore <wes@wezm.net>

pkgname=gitui
pkgver=0.24.3
pkgrel=1
pkgdesc='Blazing fast terminal-ui for git written in Rust'
url='https://github.com/extrawurst/gitui'
arch=('loong64' 'x86_64')
license=('MIT')
# work around two libssl.so providers being in the repos by only depending on package for now
depends=('gcc-libs' 'libgit2.so' 'libxcb' 'openssl' 'zlib')
makedepends=('cargo' 'python') # xcb crate needs python
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('a5fc6b52a4db0037c3351b9743af49c8bb9ccff4dda5bdb064bab9e59f68fde2')
b2sums=('a861679de253f179e40bdae65d161f4407778edeebad1bd5b358601d4e813fe04fe8dca414d278459e0db7f1fc65ec8d038ac3f4982d0507926a08ba077017c9')

prepare() {
  cd "${pkgname}-${pkgver}"
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd "${pkgname}-${pkgver}"
  CFLAGS+=" -ffat-lto-objects"
  cargo build --frozen --release
}

check() {
  cd "${pkgname}-${pkgver}"
  cargo test --frozen
}

package() {
  cd "${pkgname}-${pkgver}"
  install -Dm 755 target/release/gitui -t "${pkgdir}/usr/bin/"
  install -Dm 644 {KEY_CONFIG,README,THEMES}.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
